package com.btshop.goods.exception;

import com.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName: BaseExceptionHandler
 * @description: 异常处理器
 * @author: 李东
 * @Date: 2020-7-15 18:43
 */
@Slf4j
@ControllerAdvice
public class BaseExceptionHandler {

    @ExceptionHandler(value = Throwable.class)
    @ResponseBody
    public Result exceptionHander(Throwable e){
        log.error("【goods-service】 produce exception , exception is : {}",e);
        return Result.buildFail(e.getMessage());
    }

}
